package com.uday.myworld;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class first extends Activity {

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.first);
        
        Button bv = (Button) findViewById(R.id.b_search);
       
        final EditText et = (EditText) findViewById(R.id.e_loc);
        bv.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) 
			{
				Intent i = new Intent(first.this,found.class);
				i.putExtra("location", et.getText().toString()); 				
				startActivity(i);
				
			}
		});
        
        
        Button ba = (Button) findViewById(R.id.b_addloc);        
        ba.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) 
			{
				Intent i = new Intent(first.this,add.class);
				startActivity(i);
				
			}
		});
    }
	  @Override
		public boolean onCreateOptionsMenu(Menu menu) {
			MenuInflater inflater = getMenuInflater();
			inflater.inflate(R.layout.menu, menu);
			return true;
		}

		@Override
		public boolean onOptionsItemSelected(MenuItem item) {
			switch (item.getItemId()) {
			case R.id.exit:
				finish();
				return true;
			default:
				return super.onOptionsItemSelected(item);
			}
		}
}
